<template>
  <div class="home">
    <!-- 欢迎信息区域 -->
    <div class="welcome-section">
      <el-row :gutter="20">
        <el-col :span="16">
          <div class="welcome-card">
            <div class="welcome-info">
              <img src="https://api.iconify.design/material-symbols:school-outline.svg" class="welcome-icon" />
              <div class="welcome-text">
                <h2>欢迎使用智学云帆教学管理系统</h2>
                <p>{{ getCurrentTime() }}</p>
              </div>
            </div>
          </div>
        </el-col>
        <el-col :span="8">
          <div class="weather-card">
            <el-icon class="weather-icon"><Sunny /></el-icon>
            <div class="weather-info">
              <div class="temperature">25°C</div>
              <div class="location">北京市 晴</div>
            </div>
          </div>
        </el-col>
      </el-row>
    </div>

    <!-- 数据统计卡片 -->
    <div class="statistics-section">
      <el-row :gutter="20">
        <el-col :span="6">
          <div class="stat-card" style="background: linear-gradient(135deg, #36D1DC 0%, #5B86E5 100%)">
            <el-icon><School /></el-icon>
            <div class="stat-info">
              <div class="stat-value">12</div>
              <div class="stat-label">在校班级数</div>
            </div>
          </div>
        </el-col>
        <el-col :span="6">
          <div class="stat-card" style="background: linear-gradient(135deg, #FF9966 0%, #FF5E62 100%)">
            <el-icon><User /></el-icon>
            <div class="stat-info">
              <div class="stat-value">368</div>
              <div class="stat-label">在校学员数</div>
            </div>
          </div>
        </el-col>
        <el-col :span="6">
          <div class="stat-card" style="background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%)">
            <el-icon><UserFilled /></el-icon>
            <div class="stat-info">
              <div class="stat-value">45</div>
              <div class="stat-label">教职工数量</div>
            </div>
          </div>
        </el-col>
        <el-col :span="6">
          <div class="stat-card" style="background: linear-gradient(135deg, #4E54C8 0%, #8F94FB 100%)">
            <el-icon><OfficeBuilding /></el-icon>
            <div class="stat-info">
              <div class="stat-value">6</div>
              <div class="stat-label">部门数量</div>
            </div>
          </div>
        </el-col>
      </el-row>
    </div>

    <!-- 快捷入口 -->
    <div class="quick-access-section">
      <el-row :gutter="20">
        <el-col :span="12">
          <el-card class="quick-card">
            <template #header>
              <div class="card-header">
                <span><el-icon><Calendar /></el-icon> 待办事项</span>
                <el-button text>查看更多</el-button>
              </div>
            </template>
            <div class="todo-list">
              <div v-for="(item, index) in todoList" :key="index" class="todo-item">
                <el-icon><Timer /></el-icon>
                <span>{{ item }}</span>
              </div>
            </div>
          </el-card>
        </el-col>
        <el-col :span="12">
          <el-card class="quick-card">
            <template #header>
              <div class="card-header">
                <span><el-icon><Bell /></el-icon> 系统公告</span>
                <el-button text>查看更多</el-button>
              </div>
            </template>
            <div class="notice-list">
              <div v-for="(notice, index) in notices" :key="index" class="notice-item">
                <el-icon><Message /></el-icon>
                <span>{{ notice.title }}</span>
                <span class="notice-time">{{ notice.time }}</span>
              </div>
            </div>
          </el-card>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { 
  School, 
  User, 
  UserFilled, 
  OfficeBuilding,
  Calendar,
  Bell,
  Timer,
  Message,
  Sunny
} from '@element-plus/icons-vue'

const todoList = ref([
  '新入职教师培训会议 09:30',
  '教学工作例会 14:00',
  '学期教学计划审核',
  '教师课程安排确认'
])

const notices = ref([
  { title: '关于2024年春季学期开学安排的通知', time: '2024-01-20' },
  { title: '教师教学质量评估工作开始', time: '2024-01-19' },
  { title: '关于组织教师参加专业技能提升培训的通知', time: '2024-01-18' },
  { title: '学生实训基地建设项目启动', time: '2024-01-17' }
])

const getCurrentTime = () => {
  const now = new Date()
  const year = now.getFullYear()
  const month = now.getMonth() + 1
  const date = now.getDate()
  const day = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'][now.getDay()]
  return `${year}年${month}月${date}日 ${day}`
}
</script>

<style scoped>
.home {
  padding: 20px;
}

.welcome-section {
  margin-bottom: 20px;
}

.welcome-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 8px;
  padding: 20px;
  height: 120px;
  color: white;
}

.welcome-info {
  display: flex;
  align-items: center;
  gap: 20px;
}

.welcome-icon {
  width: 60px;
  height: 60px;
  filter: invert(1);
}

.welcome-text h2 {
  margin: 0;
  font-size: 24px;
  margin-bottom: 10px;
}

.welcome-text p {
  margin: 0;
  font-size: 16px;
  opacity: 0.9;
}

.weather-card {
  background: linear-gradient(135deg, #00b4db 0%, #0083b0 100%);
  border-radius: 8px;
  padding: 20px;
  height: 120px;
  color: white;
  display: flex;
  align-items: center;
  gap: 20px;
}

.weather-icon {
  font-size: 48px;
}

.weather-info .temperature {
  font-size: 32px;
  font-weight: bold;
}

.weather-info .location {
  font-size: 16px;
  opacity: 0.9;
}

.statistics-section {
  margin-bottom: 20px;
}

.stat-card {
  padding: 20px;
  border-radius: 8px;
  color: white;
  height: 120px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: transform 0.3s;
}

.stat-card:hover {
  transform: translateY(-5px);
}

.stat-card .el-icon {
  font-size: 48px;
  opacity: 0.8;
}

.stat-info {
  flex-grow: 1;
}

.stat-value {
  font-size: 36px;
  font-weight: bold;
  margin-bottom: 5px;
}

.stat-label {
  font-size: 14px;
  opacity: 0.9;
}

.quick-access-section {
  margin-bottom: 20px;
}

.quick-card {
  height: 350px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header .el-icon {
  margin-right: 5px;
}

.todo-list, .notice-list {
  .todo-item, .notice-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    
    &:last-child {
      border-bottom: none;
    }

    .el-icon {
      font-size: 18px;
      color: #409EFF;
    }
  }
}

.notice-item {
  display: flex;
  align-items: center;
  justify-content: space-between;

  .notice-time {
    color: #909399;
    font-size: 13px;
  }
}
</style> 